package cn.cloud.search.server.query_creater.impl;

import org.apache.log4j.Logger;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.queryParser.ParseException;
import org.apache.lucene.queryParser.QueryParser;
import org.apache.lucene.search.Query;
import org.apache.lucene.util.Version;

import cn.cloud.search.server.query_creater.IDomainQueryCreator;

public class DomainQueryCreator implements IDomainQueryCreator {
	
	private static final Logger log = Logger.getLogger(DomainQueryCreator.class);
	
	

	public Query creator(String types) {
		// TODO Auto-generated method stub
		Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_CURRENT);
		QueryParser parser = new QueryParser(Version.LUCENE_CURRENT, "type", analyzer);
		Query q = null;
		try {
			q = parser.parse(types);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			log.info("creater type query is err:"+e,e);
		}
		return q;
	}

}
